package com.interagriculture.mapper;

import com.interagriculture.entity.Dfw;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface DfwMapper {
    /**
     * 获取所有信息
     */
    @Select("select * from dfw")
    List<Dfw> getAll();

    /**
     * 插入一条信息
     * @param dfw
     */
    @Insert("insert into dfw(session, time, top, top_money, last, last_money, remark) " +
            "values " +
            "(#{session},#{time},#{top},#{topMoney},#{last},#{lastMoney},#{remark})")
    void insert(Dfw dfw);

    /**
     * 更新一条信息
     * @param dfw
     */
    @Update("update dfw set session = #{session},time = #{time},top = #{top},top_money = #{topMoney}," +
            "last = #{last},last_money = #{lastMoney},remark = #{remark} where id = #{id}")
    void update(Dfw dfw);

    /**
     * 删除一条信息
     * @param id
     */
    @Delete("delete from dfw where id = #{id}")
    void deleteById(Integer id);
}
